package com.anyisn.anyflickr.shell.model
{
	import flash.filesystem.File;
	
	import org.puremvc.as3.multicore.utilities.air.xmldb.model.XMLDatabaseProxy;

	public class AppXMLDataProxy extends XMLDatabaseProxy
	{
		public static const NAME:String = 'AppXMLDataProxy';
		
		public function AppXMLDataProxy(data:Object=null)
		{
			super(NAME, data);
			initialize('data.xml',File.applicationStorageDirectory);
		}
		
		override protected function build():XML {
			var date:Date = new Date();
			var dbXML:XML = <AnyFlickr author="Minyi-Yan" date={date}/>;
			var framework:XML = <Framework name="PureMVC_AS3_MultiCore" revision="68"/>;
			var utilities:XML = <Utilities>
									<Utility name="Utility_AS3_AIR_XMLDatabase" revision="19"/>
									<Utility name="Utility_AS3_MultiCore_Pipes" revision="84"/>
								</Utilities>;
			var libs:XML =		<Libs>
									<Lib name="as3corelib" revision="113"/>
									<Lib name="as3flickrlib" revision="37"/>
								</Libs>;
			var settings:XML = 	<Settings>
									<Photos>
										<List perpage="50"/>
										<Slide perpage="50" delay="5"/>
									</Photos>
									<Photo>
										<Download>
											<Single path=""/>
											<Batch path=""/>
										</Download>
									</Photo>
								</Settings>;
			framework.appendChild(utilities);
			dbXML.appendChild(framework);
			dbXML.appendChild(libs);
			dbXML.appendChild(settings);
			return dbXML;
		}
		
		override public function onRegister():void {
			facade.registerProxy(new SettingsProxy(xml.Settings));
		}
	}
}